/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LianBao
 * Date: 2024-03-12
 * Time: 15:29
 */
public class Solution3 {


    public String toLowerCase(String s) {
        StringBuffer str = new StringBuffer(s);
        for (int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            if (ch >= 'A' && ch <= 'Z') {
                str.setCharAt(i, (char) ((int) ch + 32));
            }
        }
        return str.toString();
    }


    public static int countSegments(String s) {
        s = s.trim();
        String[] ret = s.split(" ");
        int count = 0;
        for (int i = 0; i < ret.length; i++) {
            if (ret[i] != "") {
                count++;
            }
        }
        return count;
    }

    public static void main(String[] args) {
        System.out.println(countSegments(", , , ,        a, eaefa"));
    }

}


